type IsUnion<A, B = A> = A extends A ? [B] extends [A] ? false : true : never
type Test1 = IsUnion<1 | 2 | 3> 
//  A extends A 触发分布式条件类型，让A的每个类型单独传入，[B] extends [A] ,这样不直接写B可以避免触发分布式条件类型，B就是整个联合类型

type BEM<Block extends string, Element extends string[], Modifers extends string[]> = `${Block}__${Element[number]}---${Modifers[number]}`
type Test2 = BEM<'abin', ['div', 'span'], ['warning', 'success']>

// 全组合
type Comination<A extends string, B extends string> = A | B | `${A}|${B}` | `${B}|${A}`
type AllCombinations<A extends string, B extends string = A> = A extends A ? Comination<A, AllCombinations<Exclude<B, A>>> : never
type Test3= AllCombinations<'a' | 'b' | 'c'>
// A extends A，让联合类型的每个类型单独传入做处理
